<?php
/**
 * Created by PhpStorm.
 * User: 小蛮哼哼哼
 * Email: 243194993@qq.com
 * Date: 2022/5/18
 * Time: 20:54
 * motto: 现在的努力是为了小时候吹过的牛逼！
 */

namespace app\api\controller\v1;

use app\common\lib\Show;
use app\common\lib\Status;
use app\common\model\MallCollect;
use think\App;

class Collection extends Base
{
    protected $model = null;

    public function __construct(App $app)
    {
        parent::__construct($app);
        $this->model = new MallCollect();
    }

    public function getCollectionByList()
    {
        $limit = $this->request->param('limit', 10, 'intval');
        $page = $this->request->param('page', 1, 'intval');
        $row = $this->model
            ->alias('c')
            ->join('mall_goods g', 'c.goods_id = g.id')
            ->where('openid', '=', $this->m_openid)
            ->where('g.delete_time',null)
            ->paginate($limit)
            ->toArray();

        return Show::json_show(Status::mini_normal, 'ok', $row['data'],$row['total'],false,$row['last_page']);
    }
}